GtkCssStyle *style,
GtkCssStyle *parent_style)
{
- GtkCssValue *result;
GtkIconTheme *icontheme;
- icontheme = gtk_icon_theme_get_for_screen (_gtk_settings_get_screen (_gtk_style_provider_private_get_settings (provider)));
-
- result = g_object_get_data (G_OBJECT (icontheme), "-gtk-css-value");
- if (result)
- return _gtk_css_value_ref (result);
-
- result = _gtk_css_icon_theme_value_new ();
- result->icontheme = g_object_ref (icontheme);
-
- g_object_set_data (G_OBJECT (icontheme), "-gtk-css-value", result);
- result->changed_id = g_signal_connect (icontheme, "changed", G_CALLBACK (gtk_css_value_icon_theme_changed_cb), result);
+ if (icon_theme->icontheme)
+ icontheme = icon_theme->icontheme;
+ else
+ icontheme = gtk_icon_theme_get_for_screen (_gtk_settings_get_screen (_gtk_style_provider_private_get_settings (provider)));
- return result;
+ return gtk_css_icon_theme_value_new (icontheme);
}
static gboolean
gtk_css_value_icon_theme_print
};
+static GtkCssValue default_icon_theme_value = { >K_CSS_VALUE_ICON_THEME, 1, NULL, 0 };
+
GtkCssValue *
-_gtk_css_icon_theme_value_new (void)
+gtk_css_icon_theme_value_new (GtkIconTheme *icontheme)
{
- return _gtk_css_value_new (GtkCssValue, >K_CSS_VALUE_ICON_THEME);
+ GtkCssValue *result;
+
+ if (icontheme == NULL)
+ return _gtk_css_value_ref (&default_icon_theme_value);
+
+ result = g_object_get_data (G_OBJECT (icontheme), "-gtk-css-value");
+ if (result)
+ return _gtk_css_value_ref (result);
+
+ result = _gtk_css_value_new (GtkCssValue, >K_CSS_VALUE_ICON_THEME);
+ result->icontheme = g_object_ref (icontheme);
+
+ g_object_set_data (G_OBJECT (icontheme), "-gtk-css-value", result);
+ result->changed_id = g_signal_connect (icontheme, "changed", G_CALLBACK (gtk_css_value_icon_theme_changed_cb), result);
+
+ return result;
+}
+
+GtkCssValue *
+gtk_css_icon_theme_value_parse (GtkCssParser *parser)
+{
+ GtkIconTheme *icontheme;
+ GtkCssValue *result;
+ char *s;
+
+ s = _gtk_css_parser_read_string (parser);
+ if (s == NULL)
+ return NULL;
+
+ icontheme = gtk_icon_theme_new ();
+ gtk_icon_theme_set_custom_theme (icontheme, s);
+
+ result = gtk_css_icon_theme_value_new (icontheme);
+
+ g_object_unref (icontheme);
+ g_free (s);
+
+ return result;
}
GtkIconTheme *
icon_theme_value_parse (GtkCssStyleProperty *property,
GtkCssParser *parser)
{
- _gtk_css_parser_error (parser, "Only 'inherit', 'initial' or 'unset' are allowed");
-
- return NULL;
+ return gtk_css_icon_theme_value_parse (parser);
}
/*** REGISTRATION ***/
query_length_as_double,
assign_length_from_double,
_gtk_css_font_size_value_new (GTK_CSS_FONT_SIZE_MEDIUM));
-
- /* properties that aren't referenced when computing values
- * start here */
gtk_css_style_property_register ("-gtk-icon-theme",
GTK_CSS_PROPERTY_ICON_THEME,
G_TYPE_NONE,
icon_theme_value_parse,
NULL,
NULL,
- _gtk_css_icon_theme_value_new());
+ gtk_css_icon_theme_value_new (NULL));
+
+ /* properties that aren't referenced when computing values
+ * start here */
gtk_css_style_property_register ("background-color",
GTK_CSS_PROPERTY_BACKGROUND_COLOR,
GDK_TYPE_RGBA,